/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Zimlet;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class GetAllZimlets
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public boolean domainAuthSufficient(Map<String, Object> context)
/*    */   {
/* 34 */     return true;
/*    */   }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context) throws ServiceException
/*    */   {
/* 39 */     String exclude = request.getAttribute("exclude", "none");
/* 40 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 41 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 43 */     List<Zimlet> zimlets = prov.listAllZimlets();
/*    */     
/* 45 */     AdminAccessControl aac = AdminAccessControl.getAdminAccessControl(zsc);
/*    */     
/* 47 */     Element response = zsc.createElement(AdminConstants.GET_ALL_ZIMLETS_RESPONSE);
/* 48 */     if ("extension".equalsIgnoreCase(exclude)) {
/* 49 */       for (Zimlet zimlet : zimlets) {
/* 50 */         if ((!zimlet.isExtension()) && 
/* 51 */           (aac.hasRightsToList(zimlet, Rights.Admin.R_listZimlet, null))) {
/* 52 */           GetZimlet.encodeZimlet(response, zimlet, null, aac.getAttrRightChecker(zimlet));
/*    */         }
/*    */       }
/* 55 */     } else if ("mail".equalsIgnoreCase(exclude)) {
/* 56 */       for (Zimlet zimlet : zimlets) {
/* 57 */         if ((zimlet.isExtension()) && 
/* 58 */           (aac.hasRightsToList(zimlet, Rights.Admin.R_listZimlet, null))) {
/* 59 */           GetZimlet.encodeZimlet(response, zimlet, null, aac.getAttrRightChecker(zimlet));
/*    */         }
/*    */       }
/*    */     } else {
/* 63 */       for (Zimlet zimlet : zimlets) {
/* 64 */         if (aac.hasRightsToList(zimlet, Rights.Admin.R_listZimlet, null)) {
/* 65 */           GetZimlet.encodeZimlet(response, zimlet, null, aac.getAttrRightChecker(zimlet));
/*    */         }
/*    */       }
/*    */     }
/* 69 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 74 */     relatedRights.add(Rights.Admin.R_listZimlet);
/* 75 */     relatedRights.add(Rights.Admin.R_getZimlet);
/*    */     
/* 77 */     notes.add("If the authenticated admin does not have the corresponding list{Entry} right for an entry, the entry is skipped in the getAllXXX/searchXXX/searchDirectoryResponse,  no PERM_DENIED exception will be thrown. Attributes that are not allowed to be get by the authenticated admin will be returned as <a n=\"{attr-name}\" pd=\"1\"/>.");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/GetAllZimlets.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */